-
Notifications
You must be signed in to change notification settings - Fork 334
[BUG] Local testing using optional dicts with optional values does not work #3294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Local testing using optional dicts with optional values does not work #3294
Conversation
-e Signed-off-by: machichima <[email protected]>
-e Signed-off-by: machichima <[email protected]>
-e Signed-off-by: machichima <[email protected]>
-e Signed-off-by: machichima <[email protected]>
-e Signed-off-by: machichima <[email protected]>
-e Signed-off-by: machichima <[email protected]>
-e Signed-off-by: machichima <[email protected]>
-e Signed-off-by: machichima <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3294 +/- ##
==========================================
+ Coverage 76.42% 76.59% +0.16%
==========================================
Files 215 215
Lines 22545 22548 +3
Branches 2969 2969
==========================================
+ Hits 17230 17270 +40
+ Misses 4498 4474 -24
+ Partials 817 804 -13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I tested it looks good, thank you |
pingsutw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @machichima
…t work (flyteorg#3294) Signed-off-by: machichima <[email protected]> Signed-off-by: Atharva <[email protected]>
Tracking issue
Closes flyteorg/flyte#6474
Why are the changes needed?
When running task locally, using optional list values types (i.e.
dict[str, list[str] | None] | None) will cause error. However, when running such task on the cluster it worksWhat changes were proposed in this pull request?
Error occurs when we call
_are_types_castable(List[Sample], Union). In original code, the check for collection type will directly returnFalse, which indicates thatList[Sample]is not castable toUnion[List[Sample], None], leading to the error.In this PR, I deal with
union_typefirst in_are_types_castablefunction to overcome this problem.How was this patch tested?
Test with the following script. See result in Screenshots section.
Setup process
Screenshots
Successfully execute the above script:
Check all the applicable boxes
Related PRs
Docs link
Summary by Bito
This pull request fixes a bug in type casting for optional dictionary values, ensuring the `_are_types_castable` function properly handles union types. It also includes minor code cleanup to enhance error handling in type transformations.